Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make old worlds have min Y 0 #1396

Merged
merged 1 commit into from
Nov 24, 2024
Merged

Make old worlds have min Y 0 #1396

merged 1 commit into from
Nov 24, 2024

Conversation

Pablete1234
Copy link
Member

@Pablete1234 Pablete1234 commented Sep 9, 2024

Makes it so old maps on modern servers will have a min y = 0, meaning you can't build under y=0, so it behaves as they used to.

To make this happen a bunch of horrible hacks were employed:

  • Had to copy-in CraftServer#createWorld to allow a dimension that isn't one of the defaults
  • Had to register the custom dimension type via unspeakable means
    • Had to implement my own support for modifying dimension type, jumping thru alot of hoops, including the use of unsafe
  • Had to register a data fixer so worlds upgrading past 1.17 get their dimension changed
  • Turned pgm into a paper plugin, to have access to bootstrap-time code
    • This resulted in bytecode remapping no longer applying
      • Had to account InventoryView being an interface instead of a class now
      • Replaced all usages manually with a platform-dependant impl.

This would've been alot easier of paper supported modifying the dimensionType as part of world creator, and supported dimension type as a modifiable registry.

It can still be cleaned up now that i got it to a stage that works, but i don't think there's a work-around for the use of unsafe to access unmodifiable fields.

Ontop of this all, it seems that if the world is created with a different dimensions some world conversion doesn't run, leaving fences or glass panes unconnected. Opened PaperMC/DataConverter#22 to see if we can get any help for this, in the form of a fix, or a workaround of some sorts
By registering our own data fix that modifies the dimension we've been able to workaround this one

@Pablete1234 Pablete1234 added the bug Something isn't working label Sep 9, 2024
@Pablete1234 Pablete1234 changed the title Make old worlds have min Y 0, WIP. Make old worlds have min Y 0 Sep 9, 2024
@Pablete1234 Pablete1234 force-pushed the min-world-height branch 3 times, most recently from 5d82ff0 to c69b830 Compare November 24, 2024 05:51
@Pablete1234 Pablete1234 merged commit 076e68a into dev Nov 24, 2024
2 checks passed
@Pablete1234 Pablete1234 deleted the min-world-height branch November 24, 2024 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants